// sale_coin_success_page.dart
import 'package:flutter/material.dart';

class SaleCoinSuccessPage extends StatelessWidget {
  final VoidCallback onComplete;

  const SaleCoinSuccessPage({
    Key? key,
    required this.onComplete,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('出售结果'),
        leading: IconButton(
          icon: const Icon(Icons.arrow_back),
          onPressed: () => Navigator.of(context).pop(),
        ),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          children: [
            const SizedBox(height: 60),
            _buildSuccessIcon(),
            const SizedBox(height: 24),
            _buildSuccessText(),
            const SizedBox(height: 24),
            _buildCompleteButton(),
          ],
        ),
      ),
    );
  }

  Widget _buildSuccessIcon() {
    return Center(
      child: Container(
        width: 97,
        height: 106,
        decoration: BoxDecoration(
          image: const DecorationImage(
            image: AssetImage('assets/images/wode_chushou_chenggong_icon.png'),
            fit: BoxFit.contain,
          ),
        ),
      ),
    );
  }

  Widget _buildSuccessText() {
    return const Column(
      children: [
        Text(
          '出售成功',
          style: TextStyle(
            fontSize: 17,
            color: Color(0xFF2D2D2D),
            fontWeight: FontWeight.bold,
          ),
        ),
        SizedBox(height: 16),
        Text(
          '售得金额已转入您的账户中，请注意查收。',
          style: TextStyle(
            fontSize: 13,
            color: Colors.grey,
          ),
          textAlign: TextAlign.center,
        ),
      ],
    );
  }

  Widget _buildCompleteButton() {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 16),
      child: SizedBox(
        width: double.infinity,
        height: 44,
        child: ElevatedButton(
          onPressed: onComplete,
          style: ElevatedButton.styleFrom(
            backgroundColor: const Color(0xFFFF4974),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(5),
            ),
          ),
          child: const Text(
            '完成',
            style: TextStyle(
              fontSize: 15,
              color: Colors.white,
            ),
          ),
        ),
      ),
    );
  }
}